<template>
  <!-- 整个页面以一个手机页面方式呈现-->
  <router-view />
  <!--视图渲染区-->
  <!-- 页面底的导航区-->
  <div id="nav">
    <router-link to="/" class="tab-bar-item">
      <div class="icon">
        <House />
      </div>
      <div>首页</div>
    </router-link>

    <router-link to="/category" class="tab-bar-item">
      <div class="icon">
        <Check />
      </div>
      <div>xxxx</div>
    </router-link>

    <router-link to="/shopcart" class="tab-bar-item">
      <div class="icon">
        <ShoppingCart />
      </div>
      <div>购物车</div>
    </router-link>

    <router-link to="/profile" class="tab-bar-item">
      <div class="icon">
        <user />
      </div>
      <div>我的</div>
    </router-link>
  </div>
</template>

<script>
import { reactive, toRefs } from "vue";
import { House, Check, ShoppingCart, User } from "@element-plus/icons-vue";

export default {
  // 组件注册
  components: {
    House,
    Check,
    ShoppingCart,
    User,
  },
  setup() {
    const state = reactive({}); // 响应式数据
    return {
      ...toRefs(state),
    };
  },
};
</script>

<style  scoped>
@import url("./assets/css/base.css"); /* 引入一个全局样式表: 1.清除标签默认样式  2. 规范整个项目通用的样式规则    */
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  background-color: #f6f6f6;
  display: flex;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;

  a {
    &.router-link-exact-active {
      color: #42b983;
    }
  }
  .tab-bar-item {
    flex: 1;
    text-align: center;
    height: 50px;
    font-size: 14px;
  }
  .tab-bar-item .icon {
    width: 20px;
    height: 20px;
    margin-top: 3px;
    display: inline-block;
    vertical-align: middle;
  }
}
</style>
